<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>主页</title>
    <link rel="stylesheet" href="../static/layui/css/layui.css">
</head>
<body>
<div class="">
    <ul class="layui-nav layui-bg-cyan">
        <li class="layui-nav-item">
            <a href="javascript:changeTab('frame/echarts.html');">仪表盘</a>
        </li>
        <li class="layui-nav-item">
            <a href="javascript:changeTab('unprocessed.html');">预约代办<span class="layui-badge-dot"></span></a>
        </li>
        <li class="layui-nav-item">
            <a href="javascript:changeTab('diagnosis.html');">病员诊断<span class="layui-badge-dot"></span></a>
        </li>
        <li class="layui-nav-item  layui-this">
            <a href="javascript:changeTab('info.html');">我的信息</a>
        </li>
        <li class="layui-nav-item" style="float: right;">
            <a href="javascript:void(0);">
                <img src="../static/img/111.jpg" class="layui-nav-img" alt="">
                <span id="myName">我</span>
            </a>
            <dl class="layui-nav-child">
                <dd><a href="javascript:logout();">退出</a></dd>
            </dl>
        </li>
    </ul>
</div>
<div class="layui-container" style="width: 100%;">
    <div class="layui-row">
        <iframe id="myTab" src="info.html" width="100%;" height="888px" frameborder="0"></iframe>
    </div>
    <div class="layui-row">
        <hr>
    </div>
    <div class="layui-row" style="text-align: center">
        <p>版权所有：四川大学华西医院&nbsp;&nbsp;&nbsp;&nbsp;地址：四川省成都市武侯区国学巷37号</p>
        <p>联系电话：+86 150777853261&nbsp;&nbsp;EMAIL：200645049@qq.com&nbsp;&nbsp;邮编：10010</p>
    </div>
</div>
</body>
<script type="text/javascript" src="../static/layui/layui.all.js"></script>
<script type="text/javascript" src="../static/config.js"></script>
<script type="text/javascript">
    const $ = layui.$;
    const layer = layui.layer;
    const form = layui.form;

    console.log(localStorage.getItem("x-token"));

    $.post({
        url: baseUrl + "/hospital-doctor/doctor/info",
        headers: {
            "x-token": localStorage.getItem("x-token")
        },
        success: function (res) {
            console.log(res.data);
            if (res.data != null) {
                $("#myName").text(res.data.name);
            } else {
                layer.msg(res.msg);
                setInterval(function () {
                    location.href = "login.html";
                }, 500);
            }
        }
    });

    function logout() {
        localStorage.removeItem("x-token");
        location.href = "login.html";
    }

    function changeTab(src) {
        $("#myTab").attr("src", src);
    }

</script>
</html>